package com.yanyeori.framework.core.constant;

/**
 * WebResponse 错误码
 *
 * @author chenkuan 2020/12/4
 */
public enum BaseWebCodeEnum {
    OK(200, "Success"),
    BAD_REQUEST(400, "Bad Request"),
    UNAUTHORIZED(401, "Unauthorized, Please Login"),
    FORBIDDEN(403, "Forbidden, Access Denied"),
    NOT_FOUND(404, "Not Found"),
    METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
    SERVER_EXCEPTION(500, "Server Exception"),

    SERVER_BUSY(900, "Server Busy"),
    NO_RESOURCE_PERMISSIONS(901, "No Resource Permissions: {}"),
    NO_USER_CONTEXT(902, "No user context found");

    private final int code;
    private final String msg;

    BaseWebCodeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int code() {
        return code;
    }

    public String msg() {
        return msg;
    }
}
